<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   xmlns:pe="http://primefaces.org/ui"
   template="/WEB-INF/templates/default.xhtml">
   
   	<f:metadata>
	   	<f:viewParam name="bulletinId" value="#{bulletinHome3.id}"></f:viewParam>
	   	<f:viewParam name="taskId" value="#{bpmHome.taskId}"></f:viewParam>
	   	<f:viewParam name="moduleName" value="择优选取结果审核"></f:viewParam>
	   	<f:event listener="#{bulletinHome3.initConversation()}" type="preRenderView"></f:event>
   	</f:metadata>
   	<ui:define name="head">
   		<style type="text/css">
   			.removeButton {
   				float: right;
   				margin-right: 20px;
   			}
   			.limitUnit{
   				margin-top:5px;
   			}
   		</style>
   	</ui:define>
   	<ui:define name="content">
   
		<h:form id="editForm"  >         
			<p:panel id="panel" header="择优选取公告信息" style="margin-bottom:10px;">
		       <p:messages id="messages" closable="true"><p:autoUpdate/></p:messages>
		        <ui:include src="../template/include/bulletinInfo.xhtml" />
			</p:panel>
			<p:panel id="requalifations" header="资质要求" style="margin-bottom:10px;">
				<ui:include src="../template/include/bulletinReqInfo.xhtml" />		 
			</p:panel>
			<p:panel header="相关附件">	
				 <ui:include src="/WEB-INF/templates/include/bulletinAttachments.xhtml" />
			</p:panel>
						
			<p:panel header="备选中介报名材料评分">
				<p:dataTable value="#{bulletinHome3.instance.bestTrades}" var="_trade" rowIndexVar="_row">
					<p:column headerText="序号" style="text-align: center;" width="30">
						<h:outputText value="#{_row + 1}" />
					</p:column>
					
					<p:column headerText="中介机构" width="300">
						<h:outputText value="#{_trade.supplier.cnname}" />
					</p:column>
					<p:column headerText="信用分" width="80">
						<h:outputText value="#{_trade.supplier.creditScore}" />
					</p:column>
					<p:column headerText="报价">
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{_trade.tradeReportData.offer}">
								<f:convertNumber maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					<p:column headerText="报价分值">
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{_trade.tradeReportData.offerScore}">
								<f:convertNumber maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					<c:forEach items="#{bulletinHome3.instance.defs}" var="_rd">
						<p:column headerText="#{_rd.requiredName}">
							<p:outputPanel style="text-align: right;">
								<h:outputText value="#{bestTradeEvaluationOfBulletinList.resultMap[_trade.id][_rd.id].score}">
									<f:convertNumber minFractionDigits="1" maxFractionDigits="2" />
								</h:outputText>
							</p:outputPanel>
						</p:column>
					</c:forEach>
					
					<p:column headerText="合计">
						<c:set var="tradeSum" value="0" />
						<c:forEach items="#{bulletinHome3.instance.defs}" var="_rd">
							<c:set var="tradeSum" value="#{tradeSum + bestTradeEvaluationOfBulletinList.resultMap[_trade.id][_rd.id].score}" />
						</c:forEach>
						<p:outputPanel style="text-align: right;">
							<h:outputText value="#{tradeSum+_trade.tradeReportData.offerScore}">
								<f:convertNumber minFractionDigits="1" maxFractionDigits="2"/>
							</h:outputText>
						</p:outputPanel>
					</p:column>
					
					<p:column headerText="操作" width="160" style="text-align: center;">
						<p:button value="报名材料打包下载" href="/rest/trade/archive/#{_trade.id}"></p:button>
					</p:column>
				</p:dataTable>
			</p:panel>
			<p:panel header="即将中选中介">
				<p style="color:red;font-size:18px;">若评分、报价、信用分都相同时，选取结果为随机，此结果仅供参考！</p>
				<h:outputText value="#{bulletinHome3.highScoreTrade.supplier.cnname}" />
			</p:panel>
			<div style="margin-top:10px;">
				<p:outputLabel value="审批意见" for="refuseReason" style="display:inline-block; margin-bottom: 60px;    vertical-align: middle;"></p:outputLabel>
	   			<p:inputTextarea id="refuseReason"
	   				required="true"
	   				value="#{bulletinHome3.refuseReason}"
	   				rows="5"
	   				cols="80"></p:inputTextarea>
			</div>
			
			<p:commandButton action="#{bulletinHome3.auditBestChoose()}" value="审核通过" ajax="false" />
			<p:commandButton action="#{bulletinHome3.refuseBestChoose()}" value="驳回" ajax="false" />
			<p:button rendered="false" href="#" onclick="PF('refuseConfirmDialog').show();" value="驳回"></p:button>
			<p:commandButton action="#{bulletinHome3.cancel()}" value="取消" immediate="true"></p:commandButton>
		</h:form>
		
		<p:dialog
		 	rendered="false"
			id="confirmConfirmDialog"
			header="请输入原因"
			widgetVar="refuseConfirmDialog"
			width="640"
			height="480"
			resizable="false">
			<p:panel>
				<h:form>
					<h:panelGrid width="100%" style="text-align: center;">
						<h:inputTextarea
							id="refuseReason"
							value="#{bulletinHome3.refuseReason}"
							rows="15"
							cols="80"
							required="true" />
	
						<p:commandButton
							action="#{bulletinHome3.refuseBestChoose()}"
							value="驳回"
							ajax="false"></p:commandButton>
					</h:panelGrid>

				</h:form>
			</p:panel>
		</p:dialog>
		
		<p:dialog
			id="refuseConfirmDialog"
			header="请输入原因"
			widgetVar="refuseConfirmDialog"
			width="640"
			height="480"
			resizable="false">
			<p:panel>
				<h:form>
					<h:panelGrid width="100%" style="text-align: center;">
						<h:inputTextarea
							id="refuseReason"
							value="#{bulletinHome3.refuseReason}"
							rows="15"
							cols="80"
							required="true" />
	
						<p:commandButton
							action="#{bulletinHome3.refuseBestChoose()}"
							value="驳回"
							ajax="false"></p:commandButton>
					</h:panelGrid>

				</h:form>
			</p:panel>
		</p:dialog>

	</ui:define>
</ui:composition>
